

<template>
  <footer class="footer">
    <span class="todo-count">剩余<strong>{{sum}}</strong></span>
    <ul class="filters">
      <li>
        <a :class="{ selected:footer.condition === 0}" href="javascript:;" @click="changeCondition(0)" >全部</a>
      </li>
      <li>
        <a :class="{ selected:footer.condition === 1}" href="javascript:;" @click="changeCondition(1)">未完成</a>
      </li>
      <li>
        <a :class="{ selected:footer.condition === 2}" href="javascript:;" @click="changeCondition(2)">已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="cleardone">清除已完成</button>
  </footer>
</template>

<script>
import { mapMutations,mapGetters,mapState} from 'vuex';
export default {
  methods: {
    ...mapMutations("main", ["clearDone"]),

    cleardone() {
      this.clearDone()
    },
      ...mapMutations("footer",["changeNum"]),
 
    changeCondition(num) {
      this.changeNum(num)
     
    }
  },
  computed: {
  
    ...mapGetters(["sum"]),
    ...mapState(["footer"])
  }
}
</script>